package cn.liontalk.concurrent;

public class YieldExampleClient {

    public static void main(String[] args) {

        Thread xiaoming = new Thread(()->{
            for(int i=0;i<30;i++){
                System.out.println("xiaoming-->" + i);
                if(i==20){
                    Thread.yield();
                }
            }
        });

        Thread xiaozhang = new Thread(()->{
            for(int i=0;i<10;i++){
                System.out.println("xiaozhang-->" + i);
            }
        });

        xiaoming.start();
        xiaozhang.start();

        System.out.println("Thread.currentThread().getId() ====>>>"+ Thread.currentThread().getId());
    }
}
